-- BetterCompass v1.2 by GraySloth 2013-Sep-12

local function OnLoad(inst, data)
	inst:AddComponent("equippable")
	inst:DoTaskInTime(3, function()
		bettercompass(inst)
	end)
end

local function onequip(inst, owner)
	local minimap = TheSim:FindFirstEntityWithTag("minimap")
	
	if minimap then
		minimap.MiniMap:EnableFogOfWar(false)
	end
end

local function onunequip(inst, owner) 
	local minimap = TheSim:FindFirstEntityWithTag("minimap")
	
	if minimap then
		minimap.MiniMap:EnableFogOfWar(true)
	end
end

function bettercompass(inst)
    inst:AddComponent("equippable")
	inst.components.equippable:SetOnEquip( onequip )
    inst.components.equippable:SetOnUnequip( onunequip ) 
	inst.OnLoad = OnLoad
end
AddPrefabPostInit("compass", bettercompass)